package com.tensquare.user.exception;

import entity.Result;
import entity.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author Macross
 * @Type SimpleExceptionHandler.java
 * @Desc 简单的异常全局处理器
 * @date 2019/12/23 15:44
 */
@ControllerAdvice
public class SimpleExceptionHandler {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result exceptionHandler(Exception ex){
        ex.printStackTrace();
        return new Result(false,StatusCode.ERROR,"操作失败");
    }
}
